#ifndef _GATEWAY_CACHE_H_
#define _GATEWAY_CACHE_H_

#include <map>
#include "gateway_client.h"
#include <boost/thread.hpp>
#include <string>

class gateway_cache
{
    typedef std::map<std::string, gateway_client_ptr>Map_Client;
private:
    gateway_cache();
public:
    ~gateway_cache();

    static gateway_cache* get_instance();

    int insert_client(std::string strid, gateway_client_ptr client_ptr);

    int del_client(std::string strid, std::string addr);

    void clear();
   
private:
    static boost::uint32_t _lock_state;
    static gateway_cache* _cache;
    Map_Client _map_cache;
    boost::recursive_mutex _rmutex;
};
#endif /*_GATEWAY_CACHE_H_*/